<?php
/**
 * 商家入住基类
 * Created by Sublime Text 3.
 * @authors Rejeo (rejeo@qq.com)
 * @date    2018-05-01 02:33:19
 * @version $Id$
 */
namespace app\bis\controller;

use think\Controller;

class Base extends Controller
{
    private $account;
    // 检查是否登录
    public function _initialize()
    {
        $isLogin = $this->isLogin();
        if (!$isLogin) {
            $this->error('请登录！', 'login/index');
        }
    }

    protected function isLogin()
    {
        $user = $this->getLoginUser();
        if ($user && $user['id']) {
            return TRUE;
        }
        return FALSE;
    }

    protected function getLoginUser()
    {
        if (!$this->account) {
            $this->account = session('bisAccount', '', 'bis');
        }
        return $this->account;
    }
}
